 
  
    <h1>重设密码</h1>
    <div class="search-box">
        <div>
	        <label>注&nbsp;册&nbsp;的&nbsp;邮&nbsp;件:</label>
	        <button onClick="sendVerifyCode()">发送生验证码</button>
	    </div>
        <div>
	      <label>收到的验证码:</label>
	      <input type="text" name="acode" placeholder="输入邮件内的激活码" value="">
	    </div>
	    <div>
	      <label>设置账户密码:</label>
	      <input type="password" name="pwd1" placeholder="登录密码" value="">
	    </div>
	    <div>
	      <label>二次确认密码:</label>
	      <input type="password" name="pwd2" placeholder="登录密码" value="">
	    </div>
        <button id="reg" onClick="modifyPwd()">保存更新</button>
    </div>
    <div id="results"></div> 

<script> 
	
   var email = curUser["email"];  
   
   function sendVerifyCode(){
	   var jv={};
	   jv["mail"] = email;
	   jv["lang"] = getInputValueById("ui-lang");
	   if(jv["lang"] == 'cn'){
		   jv["lang"] = 'en';
	   }else{
		   jv["lang"] = 'cn';
	   }
	  
	   ajaxPostJson(send_vcode_url,null,jv,function(status,ret){
			  console.log("Status="+status);
			  console.log("Data="+JSON.stringify(ret,null,2)); 
			  if(ret.status==1){
				  alert("Succeed!\r\nPlease check your email for verify code"); 
			  }else{ 
				  alert("Fail!\r\n返回错误代码:"+ret.errCode+"\内容:"+ret.desc);
			  }
		  });
   }
   
   
   function modifyPwd(){
	   debugger; 
	   var pwd1 = getInputValue("pwd1");
	   var pwd2 = getInputValue("pwd2");
	   if(pwd1 != pwd2 || pwd1=="" || pwd2==""){
		   alert("请输入密码\r\n确认密码和密码必须相同");
		   return;
	   }
	   var code = getInputValue("acode");
	   if(code=="" || code.length !=6 || isDigital(code) == false){
		   alert("激活码为6个数字");
		   return;
	   }
	   var json={"code":code,"email":email,"passwd":pwd1}; //如提供了密码，则修改密码
	   
	   ajaxPostJson(reset_passwd_uri,null,json,function(status,ret){
			  console.log("Status="+status);
			  console.log("Data="+JSON.stringify(ret,null,2)); 
			  if(ret.status==1){
				  alert("Password is modified successful");
				  //showPage("login.html?email="+email);
			  }else{
				  alert("返回错误代码:"+ret.errCode+"\内容:"+ret.desc);
			  }
		  });
	   
	   
   }
   
</script>
</html>
